#include <stdio.h>
#include <stdlib.h>
#include <string.h>
// Window 离线安装GCC  https://blog.csdn.net/jbk3311/article/details/103886095
// gcc add.c -o add.exe            编译成可执行文件
// gcc -shared add.c -o add.dll    编译成动态库，python调用
 
int add_int(int, int);
float add_float(float, float);
 
int add_int(int num1, int num2)
{
    return num1 + num2;
}
 
float add_float(float num1, float num2)
{
    return num1 + num2;
}

int fac(int n)
{
	if (n<2) 
		return (1);
	return (n)*fac(n-1);
	
}

char *reverse(char *s)
{
	register char t,
	*p = s,
	*q = (s+(strlen(s)-1));
	
	while(p<q)
	{
		t = *p;
		*p++ = *q;
		*q-- = t;
	}
	// return "adafdads";
	return s;
}
 
int main()
{
    /* 我的第一个 C 程序 */
    printf("Hello, This is test demo! \n");

	printf("add_int(3,4) = %d\n", add_int(3,4));
	printf("fac(5) = %d\n", fac(5));
	
	char s[BUFSIZ];
	strcpy(s, "abcdef");
	
	printf("'abcdef' get reverse '%s'\n\n\n", reverse(s));
	
    return 0;
}
